package com.shawn.spring.boot.flowable.mapper;

import com.shawn.spring.boot.flowable.bo.User;
import com.shawn.spring.boot.flowable.entity.UserEntity;
import org.springframework.stereotype.Component;

@Component
public class UserEntityBOMapper {

  public UserEntity toUserEntity(User user) {
    return UserEntity.builder()
        .phone(user.getPhone())
        .name(user.getName())
        .email(user.getEmail())
        .code(user.getCode())
        .id(user.getId())
        .build();
  }

  public User toUser(UserEntity entity) {
    return User.builder()
        .code(entity.getCode())
        .name(entity.getName())
        .email(entity.getEmail())
        .phone(entity.getPhone())
        .id(entity.getId())
        .build();
  }
}
